<?php
require_once('../libraryfiles/config.php');
$site_title = "Administrator Site"; //Set Title of our pag
$content = 'index.php';
$include = '<link rel="stylesheet" href="../css/admin_style.css" />';
include_once TMP_ADMIN_PATH;
?>
<div class="heading">
    <h1><img src="<?php echo base_url; ?>admin/templates/image/home.png" alt="" /> <?php echo $lang['ADMIN_DASHBOARD']; ?></h1>
</div>
<div class="content">
    <div class="overview">
        <div class="dashboard-heading">Manage All Modules</div>
        <div class="dashboard-content" style="padding: 3px 0 25px 0px;">
            <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
                <tr>
                    <td>
                        <div style="margin-bottom: 5px;"><a
                                href="<?php echo base_url; ?>/admin/pages/" class="thumbnail"> <img
                                    class="img-rounded" alt="Manage page" title="Manage page"
                                    src="images/pages.png" />
                                <div class="textname" style="color: #921839;"><?php echo $lang['MANAG_PAGE']; ?></div>
                            </a></div>
                    </td>
                    <?php if ($_SESSION ['usertype'] == 1) { // can access only super administrator user?>
                    <td>
                        <div style="margin-bottom: 5px;"><a
                                href="<?php echo base_url; ?>admin/user/" class="thumbnail"> <img
                                    title="Manage User" alt="Manage User"
                                    class="img-rounded" src="images/User1.png">
                                <div style="color: #921839;" class="textname"><?php echo $lang['MANAG_USER']; ?></div>
                            </a></div>
                    </td>
                    <td>
                        <div style="margin-bottom: 5px;"><a
                                href="<?php echo base_url; ?>admin/account_type/" class="thumbnail"> <img
                                    alt="User Type" title="User Type"
                                    class="img-rounded" src="images/user_accounts.png">
                                <div class="textname" style="color: #921839;"><?php echo $lang['MANAG_USER_TYPE']; ?></div>
                            </a></div>
                    </td>
                    <?php } ?>
                    <td>
                        <div style="margin-bottom: 5px;"><a
                                href="<?php echo base_url; ?>admin/product/" class="thumbnail"> <img
                                    title="Manage product" alt="Manage Product"
                                    class="img-rounded" src="images/Safety Box v2.png">
                                <div class="textname" style="color: #921839;"><?php echo $lang['MANAG_PRO']; ?></div>
                            </a></div>
                    </td>
                     <?php if ($_SESSION ['usertype'] == 1) { // can access only super administrator user?>
                </tr>

                <tr>
                <?php }?>
                    <td>
                        <div style="margin-bottom: 5px;"><a href="<?php echo base_url; ?>admin/category/" class="thumbnail">
                                <img alt="Manage Categories" title="Manage Categories"
                                     class="img-rounded" src="images/categories.png">
                                <div class="textname" style="color: #921839;"><?php echo $lang['MANAG_CAT']; ?></div>
                            </a></div>
                    </td>
                    <td>
                        <div ><a href="<?php echo base_url; ?>admin/banner/" class="thumbnail"> <img
                                    alt="Manage Banner" title="Manage Banner"
                                    class="img-rounded" src="images/banner_design.png">
                                <div class="textname" style="color: #921839;"><?php echo $lang['MANAG_BANNER']; ?></div>
                            </a></div>
                    </td>
                     <?php if ($_SESSION ['usertype'] == 4) { // can access only super administrator user?>
                </tr>

                <tr>
                <?php }?>
                    <td>
                        <div ><a href="<?php echo base_url; ?>/admin/advertise/"
                                 class="thumbnail"> <img alt="Manage Advertise"
                                                    title="Manage Advertise"
                                                    class="img-rounded" src="images/advertising.png">
                                <div class="textname" style="color: #921839;"><?php echo $lang['MANAG_ADVERTISE']; ?></div>
                            </a></div>
                    </td>
                    <td>
                        <div ><a href="<?php echo W_ROOT . "/admin/?logout" ?>" class="thumbnail">
                                <img alt="Logout" title="Logout"
                                     class="img-rounded" src="images/logout.png">
                                <div class="textname" style="color: #921839;"><?php echo $lang['LOG_OUT']; ?></div>
                            </a></div>
                    </td>
                <?php if ($_SESSION ['usertype'] == 1) { // can access only super administrator user?>
                </tr>

                <tr>
                <?php }?>
                    <td>
                        <div ><a href="<?php echo base_url; ?>admin/vdoyoutube/" class="thumbnail">
                                <img alt="Manage Categories" title="Manage Youtube"
                                     class="img-rounded" src="images/youtube_logo.jpg">
                                <div class="textname" style="color: #921839;"><?php echo $lang['MANAGE_VIDEO']; ?></div>
                            </a></div>
                    </td>
                    <td>
                        <div ><a href="<?php echo base_url; ?>admin/setting/index.php?view=add" class="thumbnail"> <img
                                    alt="Manage Setting" title="Manage Setting"
                                    class="img-rounded" src="images/Settings.png">
                                <div class="textname" style="color: #921839;"><?php echo $lang['GLOBAL_SETING']; ?></div>
                            </a></div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <!-- end overview -->

    <div class="statistic">
    	 <div class="range">Select Report
            <select id="range">
                <option value="reportprovince" selected="selected">Popular Province</option>
                <option value="reportproduct">Popular Product</option>
            </select>
            Item
            <select id="number">
                <option value="5" selected="selected">5</option>
                <option value="10">10</option>
                <option value="15">15</option>
                <option value="20">20</option>
            </select>
        </div>
        <div class="dashboard-heading"><?php echo $lang['SELL_REVIEW']; ?></div>
        <div class="dashboard-content">
        	<script type="text/javascript">
				$(document).ready(function() {
					var number = $('#number').val();
					$('#number').on('change', function () {
						showGrap(this.value);
					});
					$('.chart-report').load('reportprovince.php?number=' + number);
					$('#range').on('change', function () {
						number = $('#number').val();
						showGrap (number);
					});
					function showGrap (number) {
						if ('reportproduct' == $('#range').val()) {
							$('.chart-report').load('reportproduct.php?number=' + number);
						} else {
							$('.chart-report').load('reportprovince.php?number=' + number);
						}
					}
				});
            </script>
          	<div class="chart-report"></div>
         </div>
    </div>

     <?php if ($_SESSION ['usertype'] == 1) { // can access only super administrator user?>
    <!--Last product-->
    <div class="latest">
        <div class="dashboard-heading"><?php echo $lang['LATEST_5_USER'];?></div>
        <div class="dashboard-content">
            <table class="list">
                <thead>
                    <tr>
                    	<td width="1"><?php echo $lang['N']; ?></td>
                        <td class="left"><?php echo $lang['USER_NAME'] ;?></td>
                        <td class="left"><?php echo $lang['USERTYPEE'];?></td>
                        <td class="left"><?php echo $lang['Email'];?></td>
                        <td class="left">Address</td>
                        <td class="left">Phone</td>
                    </tr>
                </thead>
                <tbody>
                		<?php
                			$sqlUser = "SELECT *FROM tbluser as u INNER JOIN tbluser_type AS t ON t.user_type_id=u.user_type_id WHERE t.user_type_id !=1 LIMIT 5";
                			$SQL = @mysql_query($sqlUser);
                			$i=1;
                		?>

                        <?php while($Rows = @mysql_fetch_object($SQL)) { ?>
                            <tr>
                                <td class="right"><?php echo $i;?></td>
                                <td class="left">
                                	<a href="<?php echo base_url_admin;?>/user?id=<?php echo $Rows->id?>&view=listadmin">
                                	<?php
										if($Rows->username!=""){
											echo $Rows->username;
										}else{
											echo $Rows->first_name.' '.$Rows->last_name	;
										}
									?>
									</a>
                                </td>
                                <td class="left"><?php echo $Rows->user_type_name; ?></td>
                                <td class="left"><?php echo $Rows->email; ?></td>
                                <td class="left"><?php echo $Rows->address?></td>
                                <td class="left"><?php echo $Rows->phone;?></td>

                            </tr>
                           	<?php $i++;?>
                        <?php } ?>
                </tbody>
            </table>
        </div>
    </div>
    <!--end Last product-->
    <?php }?>
    <!--[if IE]>
<script type="text/javascript" src="<?php echo base_url; ?>admin/templates/javascript/jquery/flot/excanvas.js"></script>
<![endif]-->
    <script type="text/javascript" src="<?php echo base_url; ?>admin/templates/javascript/jquery/flot/jquery.flot.js"></script>
    <script type="text/javascript" src="<?php echo base_url; ?>admin/templates/javascript/chart/highcharts.js"></script>
    <script type="text/javascript" src="<?php echo base_url; ?>admin/templates/javascript/chart/exporting.js"></script>
</div>